const validator = {
  avatar: [{ type: "string" }],
  name: [
    { type: "string", required: true },
    { min: 2, max: 10, message: "用户名长度必须在2到10个字符之间" },
  ],
  username: [
    { type: "string", required: true },
    { min: 5, max: 10, message: "账户长度必须在5到10个字符之间" },
  ],
  password: [{ type: "string", required: true }],
  email: [
    { type: "string", required: true },
    {
      pattern: /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/,
      message: "邮箱格式不正确",
    },
  ],
  loginTime: [
    { type: "string" },
    {
      pattern: /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/,
      message: "登录时间格式不正确",
    },
  ],
  logoutTime: [
    { type: "string" },
    {
      pattern: /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/,
      message: "登出时间格式不正确",
    },
  ],
};

export default validator;
